package 
{
import core.CostCount;
import core.DiscountStrategy;
import core.RebateStrategy;
import core.StrategyDefine;
import core.StrategyManager;

import flash.display.Sprite;

public class Main extends Sprite
{
	public function Main()
	{
		//注册
		StrategyManager.getInstance().registerStrategy(StrategyDefine.DISCOUNT, new DiscountStrategy());
		StrategyManager.getInstance().registerStrategy(StrategyDefine.REBATE, new RebateStrategy());
		
		var costCount:CostCount = new CostCount(StrategyDefine.REBATE);
		var price:Number;
		
		price = costCount.countCost(10000);
		trace(price);
		
		costCount.setCostStrategy(StrategyDefine.DISCOUNT);
		price = costCount.countCost(10000);
		trace(price);
	}
}
}
